package com.example.ttkl.fragment;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.ttkl.Base.BaseFragment;
import com.example.ttkl.Base.BaseRecAdapter;
import com.example.ttkl.Common;
import com.example.ttkl.R;
import com.example.ttkl.fragment.adapter.XGJRelAdapter;
import com.example.ttkl.fragment.bean.ImageTextBean;
import com.example.ttkl.fragment.XGJActivity.JSQActivity;
import com.example.ttkl.interfaces.IBasePresenter;
import com.kc.openset.ad.banner.OSETBanner;
import com.kc.openset.ad.banner.OSETBannerAd;
import com.kc.openset.ad.listener.OSETBannerAdLoadListener;
import com.kc.openset.ad.listener.OSETBannerListener;

import java.util.ArrayList;

public class XgjFragment extends BaseFragment {

    private RecyclerView mRel;
    private Activity mContext;
    private XGJRelAdapter xgjRelAdapter;//小工具适配器
    private ArrayList<ImageTextBean> list;//小工具列表

    @Override
    protected IBasePresenter initPresenter() {
        return null;
    }

    @Override
    protected int getLayout() {
        return R.layout.fragment_xgj;
    }

    @Override
    protected void initView() {
        mContext = getActivity();
        mRel = inflate.findViewById(R.id.xgj_rel);

        mRel.setLayoutManager(new GridLayoutManager(mContext, 4));
        list = new ArrayList<>();
        ImageTextBean jsq = new ImageTextBean("计算器", R.drawable.ic_luncher_round);
        list.add(jsq);
        xgjRelAdapter = new XGJRelAdapter(mContext, list);
        mRel.setAdapter(xgjRelAdapter);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {
        xgjRelAdapter.setOnClick(new BaseRecAdapter.onClick() {
            @Override
            public void click(int pos) {
                switch (pos) {
                    case 0:
                        Intent intent = new Intent(mContext, JSQActivity.class);
                        startActivity(intent);
                        break;
                }
            }
        });
    }

    @Override
    public void showTips(String tips) {

    }

    @Override
    public void showLoading(int visble) {

    }
}
